package com.example.javaproject.thread.thread;

/**
 * Description: 线程方法解析
 * <br/>Author:  tianjinyong
 * <br/>Date:    2020/7/6 4:17 PM
 */
public class T_01_ThreadMethod {

    public static void main(String[] args) {
        testJoin();
    }

    public static void testJoin() {
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                System.out.println("A" + i);
                try {
                    Thread.sleep(100);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        Thread t2 = new Thread(() -> {
            try {
                t1.join();
                System.out.println("B");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        t1.start();
        t2.start();
    }

}
